Current Location: Home> Function Categories> round

round

Round floating point numbers
Name:round
Category:math
Programming Language:php
One-line Description:Round the floating point number.

Definition and usage

round() function rounds up floating point numbers.

Example

 <?php
echo ( round ( 0.60 ) ) ;
echo ( round ( 0.50 ) ) ;
echo ( round ( 0.49 ) ) ;
echo ( round ( - 4.40 ) ) ;
echo ( round ( - 4.60 ) ) ;
?>

Try it yourself

grammar

 round ( x , prec )
parameter describe
x Optional. Specify the number to be rounded.
prec Optional. Specify the number of digits after the decimal point.

illustrate

Returns the result of rounding x according to the specified precision prec (the number of numbers after decimal decimal points). prec can also be a negative number or zero (default value).

Similar Functions
  • Ancient sine asin

    asin

    Ancientsine
  • Sow the random number generator seeds srand

    srand

    Sowtherandomnumberge
  • Convert angle to radians deg2rad

    deg2rad

    Convertangletoradian
  • Returns log(1 + number), and can calculate the exact result even when the value of number is close to zero. log1p

    log1p

    Returnslog(1+number)
  • Returns the remainder of the floating point number of division fmod

    fmod

    Returnstheremaindero
  • Hyperbolic cosine cosh

    cosh

    Hyperboliccosine
  • Returns exp(number) - 1, and can calculate the exact result even when the value of number is close to zero. expm1

    expm1

    Returnsexp(number)-1
  • Convert decimal to hexadecimal dechex

    dechex

    Convertdecimaltohexa
Popular Articles